package com.itheima03;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Test01 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable mc = new MyCallable();

        //找一个中间媒介
        FutureTask<Integer> f = new FutureTask<>(mc);
        Thread t1 = new Thread(f);
        t1.start();
        Integer integer = f.get();
        System.out.println(integer);


        FutureTask<Integer> f1 = new FutureTask<>(mc);
        Thread t2 = new Thread(f1);
        t2.start();
        Integer integer1 = f1.get();
        System.out.println(integer1);
    }
}
